mask request bytes before ctype calls in client.c#1623
Merged
Conversation
michaelrsweet
approved these changes
Jun 21, 2026
michaelrsweet
left a comment
Member
There was a problem hiding this comment.
Note that platforms where "char" is unsigned don't have this issue, which IIRC includes Linux and macOS. However, I am aware of the issue and thought we had already covered all of the calls that mattered, so thanks for the catch!
michaelrsweet
added a commit
that referenced
this pull request
Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ASan, modelling a ctype lookup that indexes its 256-entry table by the raw argument:
Spotted while reading the request path. The host parsed from the request URI and the If-Modified-Since header value both reach ctype calls on a bare char. char is signed here, so a request byte of 0x80 or above arrives as a negative int, which isdigit/isspace/isalpha must not be given. The rest of this file already masks with & 255 (see lines 2476 and 3755); these four sites were missed. The two tolower calls a bit further down are already safe, since they run only after an isxdigit check on the same byte.